package chapter14;

public class ComparableCircle extends Circle implements Comparable {

	public ComparableCircle(double radius){
		super(radius);
	}
	
	public int compareTo(ComparableCircle c){
		if (getArea() > c.getArea()){
			return 1;
		}
		else if (getArea() == c.getArea()){
			return 0;
		}
		else
			return -1;
	}
	
	public static ComparableCircle max(ComparableCircle c1, ComparableCircle c2){
		if (c1.compareTo(c2) >= 0){
			return c1;
		}
		else
			return c2;
	}
	
	public boolean equals (Object o){
		if (getRadius() == ((Circle)o).getRadius()){
			return true;
		}
		else 
			return false;
	}

}
